package com.feature.shop.user.converter;

import java.util.List;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import com.feature.core.config.MapstructTypeConvert;
import com.feature.shop.user.api.request.ShopUserListRequest;
import com.feature.shop.user.api.request.ShopUserPageRequest;
import com.feature.shop.user.api.vo.ShopUserVo;
import com.feature.shop.user.model.entity.ShopUserEntity;
import com.feature.shop.user.model.query.ShopUserQuery;

@Mapper(uses = MapstructTypeConvert.class)
public interface ShopUserConverter {
	@Mapping(source = "ids", target = "idList", qualifiedByName = "stringToInts")
	@Mapping(source = "name", target = "nameLike")
	ShopUserQuery requestToQuery(ShopUserListRequest request);
	
	@Mapping(source = "ids", target = "idList", qualifiedByName = "stringToInts")
	@Mapping(source = "name", target = "nameLike")
	ShopUserQuery requestToQuery(ShopUserPageRequest request);

	@Mapping(target = "auths", ignore = true)
    @Mapping(target = "roles", ignore = true)
    ShopUserVo entityToVo(ShopUserEntity entity);

	List<ShopUserVo> entitysToVos(List<ShopUserEntity> entitys);
}
